package top.lyc829.leetcode.T283;

import java.util.Arrays;

public class Solution {

    public void moveZeroes(int[] nums) {

        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == 0) {
                for (int j = i + 1; j < nums.length; j++) {
                    if (nums[j] != 0) {
                        int tmp = nums[i];
                        nums[i] = nums[j];
                        nums[j] = tmp;
                        break;
                    }
                }
            }
        }


        System.out.println(Arrays.toString(nums));

    }

    public static void main(String[] args) {
        Solution s = new Solution();
        s.moveZeroes(new int[]{0, 1, 0, 3, 12});
    }

}
